<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <h1>首页1</h1>
    <iframe id="frame" src="http://127.0.0.1:5502/detail.html" frameborder="0" width="800" height="500"></iframe>
</head>
<body>
    <script>
        let obj = {
            name:'张三',
            age:18
        }
        document.getElementById('frame').onload = function(){
            this.contentWindow.postMessage(obj) // 向iframe发送消息 //this.contentWindow代表引入的详情页浏览器窗口
            window.onmessage = function(e){
                console.log(e.data);
                
            }
        }
    </script>
</body>
</html>